export default {
	created() {
		//#ifdef MP-WEIXIN
		wx.showShareMenu({
			withShareTicket: true,
			menus: ['shareAppMessage', 'shareTimeline']
		});
		//#endif
	},
	data() {
		return {
			page: 2,
			share: {
				title: '自定义分享标题',
				imageUrl: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg',
			}
		}
	},
	onShareAppMessage(res) { //发送给朋友
		return {
			title: this.share.title,
			imageUrl: this.share.imageUrl,
		}
	},
	onShareTimeline(res) { //分享到朋友圈
		return {
			title: this.share.title,
			imageUrl: this.share.imageUrl,
		}
	},
	methods: {
		/**
		 * 跳转页面
		 * @param {String} url 目标页面地址
		 * @param {Object} options 参数
		 * @param {Boolean} options.login 是否检测登录  
		 */
		navTo(url, options = {}) {
			if (!url) {
				return;
			}
			if (options.login && !this.$store.getters.hasLogin) {
				url = '/pages/auth/login';
			}
			uni.navigateTo({
				url
			})
		},

		// 后退, 默认后退一步
		navBack(delta = 1) {
			// console.log('navBack', delta)
			uni.navigateBack({
				delta
			});
		},
	}
}
